package book;

//书
public class Book {
    private String title;//书名
    private String author;//作者
    private double price;//价格
    private boolean isBorrow;//是否被借

    //构造方法

    //是否被借出无需构造，默认为false 未借出

    public Book(String title,String author,double price) {
        this.title = title;
        this.author = author;
        this.price = price;
    }

    //对外输出接口
    public String getTitle() {
        return this.title;
    }
    public String getAuthor() {
        return this.author;
    }
    public double getPrice() {
        return this.price;
    }

    //对外设置接口
    public void setTitle(String title) {
        this.title = title;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public void setPrice(double price) {
        this.price = price;
    }

    public void setIsBorrow(boolean bool) {
        this.isBorrow = bool;
    }
    @Override
    public String toString() {
        return " < "+
                "书名：" +"《"+title+"》"+
                " 作者：" + author +
                " 价格：" + price +
                " 书籍状态： " + (isBorrow ?"已借出":"未借出") +
                " >";
    }
}

